Skip to content

Hybrid hitboxes#382

Open
nickalreadyinuse wants to merge 4 commits into
GooberRF:masterfrom
nickalreadyinuse:hybrid-hitboxes
Open

Hybrid hitboxes#382
nickalreadyinuse wants to merge 4 commits into
GooberRF:masterfrom
nickalreadyinuse:hybrid-hitboxes

Conversation

@nickalreadyinuse

Copy link
Copy Markdown
Contributor

Replaces single rectangular player hitbox with three hitboxes:

Sphere - head
Cylinder - torso
Capsule - legs

Hitboxes shrink correctly when players crouch and the torso/head hitbox moves with the player's pitch. Playtested quite a bit over the past month or so with bots (and with a range of client latency), but needs some testing with humans. Makes the game somewhat more difficult as these conform much better to the mesh than the stock hitbox. Very noticeable difference when shooting someone in the side.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a new “hybrid hitbox” system for multiplayer hit detection by replacing the legacy single AABB player hitbox with a split shape approach (lower capsule + upper tilted cylinder + head sphere), including lag-compensation-aware head tracking and optional debug rendering to visualize the resulting volumes.

Changes:

  • Adds split hitbox intersection logic (capsule/cylinder/sphere) and installs a call-site hook to replace the legacy AABB intersection in the multiplayer entity collision path.
  • Introduces a dedicated-server config toggle (legacy_hitboxes) and propagates it via join-accept feature flags.
  • Adds debug rendering toggles to visualize the new hitboxes (and optionally collision spheres).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
game_patch/rf/vmesh.h Exposes vmesh_get_csphere_pos to fetch collision-sphere world positions.
game_patch/multi/server.h Adds server_legacy_hitboxes() accessor.
game_patch/multi/server.cpp Toggles a lag-comp flag around weapon-fire handling.
game_patch/multi/server_internal.h Adds new server config fields (legacy_hitboxes, exclude_bots_from_player_count).
game_patch/multi/network.h Adds legacy_hitboxes join-accept feature flag bit.
game_patch/multi/network.cpp Sends/parses legacy_hitboxes in join accept extension.
game_patch/multi/multi.h Publishes compute_tilt_axis() and set_lag_comp_flag() APIs + server info field.
game_patch/multi/multi.cpp Implements the new hybrid hitbox intersection + head tracking + hook installation.
game_patch/multi/dedi_cfg.cpp Parses/prints legacy_hitboxes and exclude_bots_from_player_count config keys.
game_patch/debug/debug.cpp Renders the new hitboxes (and optional cspheres) when debug flag enabled.
game_patch/debug/debug_internal.h Declares new debug globals.
game_patch/debug/debug_cmd.cpp Adds debug hitbox flag (but currently misses wiring for csphere toggle).
docs/CHANGELOG.md Documents the new hitbox system in the changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread game_patch/multi/multi.cpp Outdated
Comment thread game_patch/multi/multi.cpp Outdated
Comment thread game_patch/multi/multi.cpp Outdated
Comment thread game_patch/multi/multi.cpp
Comment thread game_patch/multi/multi.cpp Outdated
Comment thread game_patch/debug/debug_cmd.cpp
Comment thread game_patch/debug/debug_cmd.cpp
Comment thread game_patch/multi/dedi_cfg.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread game_patch/multi/multi.cpp Outdated
Comment thread game_patch/multi/multi.cpp
Comment thread game_patch/multi/multi.cpp
Comment thread game_patch/multi/server.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment on lines +750 to +755
if (!(entity && upper_height > geo.radius)) {
geo.split = false;
geo.lower_bot = {cx, bbox_min.y, cz};
geo.lower_top = {cx, bbox_max.y, cz};
return geo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants